#pragma once
#include <boost/array.hpp>
#include <boost/scoped_ptr.hpp>
#include "UnitFwd.hpp"
#include "RigidBodyFwd.hpp"
#include "ImportExport.hpp"

class btCollisionShape;

namespace he
{
	class TerrainTile;
	class SceneNodeMotionState;

	//! Unit entity.
	class UnitEntity : boost::noncopyable
	{
		// Typedefs
	private:
		//! Vector of tile.
		typedef boost::array<TerrainTile *, 4> TerrainTileArray_t;

		// Attributes
	private:
		//! Unit.
		UnitPtr_t m_pUnit;
		//! Entity for given unit.
		Ogre::Entity *m_pEntity;
		//! Scene node to which entity is attached.
		Ogre::SceneNode *m_pSceneNode;
		//! Array of terrain tiles entity occupies.
		TerrainTileArray_t m_OccupiedTiles;
		//! Motion state for physics.
		boost::shared_ptr<SceneNodeMotionState> m_pMotionState;
		//! Collision shape.
		boost::scoped_ptr<btCollisionShape> m_pCollisionShape;
		//! Rigid body.
		RigidBodyPtr_t m_pRigidBody;

		// Operations
	public:
		//! Get entity.
		HE_ENGINE_API Ogre::Entity const &get_entity() const;
		//! Get the bounding box extensions.
		Ogre::Vector3 const get_bounding_box() const;

	public:
		UnitEntity(UnitPtr_t const &pUnit, Ogre::Entity *pEntity, Ogre::SceneNode *pSceneNode);
	};
} /*he*/
